home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / win / rtfhelp.zip / RTFHHELP.C < prev    next >
Text File  |  1994-11-06  |  3KB  |  99 lines

  1. /*
  2. ======================================================================
  3.    RTFHelp Windows Help Generation Tool
  4.    (C) Copyright 1994 by J. Hlavaty
  5.  
  6.    RTFHHelp.c
  7.    Help text and command line processing
  8. ======================================================================
  9. */
  10.  
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <string.h>
  14. #include "rtfhelp.h"
  15.  
  16.  
  17.  
  18. int ProcessArgs( int argc, char **argv )
  19. {
  20.   int thisarg = 1 ;
  21.  
  22.   if ( 1 == argc )    // only RTFHELP <Enter> was typed, the user wants help...
  23.   {
  24.      printf("\tusage:  RTFHELP <input-file(.hdc)> <output-file(.rtf)> (-o) (-f) (-q)\n") ;
  25.      printf("\t\twhere '-o' will disable output file overwrite warning\n") ;
  26.      printf("\t\t  '-f:850' will translate input from code page 850\n") ;
  27.      printf("\t\t  and '-q' will not output informational messages\n") ;
  28.  
  29. /*   JH -- stubbed out of version 2.0...
  30.  *  printf("\tThe '-rtf:<file name>' option will generate an HDC file\n") ;
  31.  *  printf("\t\t  from a valid RTF file generated by another RTF writer\n") ;
  32.  *  printf("\t\t  The 'rtf' flag may not be used with any other option\n") ;
  33. */
  34.     printf("\t\t  '-c' will use old-style RTF generation (compatibility with\n") ;
  35.     printf("\t\t  version 1.x).  Don't use unless you have old-style .HDC files.\n") ;
  36.     printf("\tThis is a bound application and may be run in DOS or OS/2\n") ;
  37.     return FALSE ;
  38.   }
  39.  
  40.   // process commands until done (thisarg == argc)
  41.   while ( thisarg != argc )
  42.   {
  43.     // is this a parameter or a file name?
  44.     if ( ( '-' == argv[thisarg][0] ) ||
  45.          ( '/' == argv[thisarg][0] ) )
  46.     { // ... a parameter
  47.        switch(tolower(argv[thisarg][1]))
  48.        {
  49.          case 'r':                           // -RTF:
  50. /*         if ( 2 == argc )                  // generating HDC from RTF file
  51.  *         {
  52.  *            SetUpGeneration( argv[thisarg] ) ; //   not in this version of RTFHelp
  53.  *         }
  54.  *         else
  55.  *         {
  56.  *           printf("\tRTFHELP:  usage for HDC generation is RTFHELP -rtf:myfile(.rtf).\n") ;
  57.  *           printf("\t\t  No other options are permitted\n") ;
  58.  *           return FALSE ;
  59.  *         }
  60. */         break;
  61.          case 'o':
  62.            bOverwrite = TRUE ;
  63.            break;
  64.          case 'c':
  65.            bCondense = FALSE ;
  66.            printf("\tRTFHELP:  compatibility mode will be used.  Please convert\n") ;
  67.            printf("\t\t  your old-style files to release 2.01+\n") ;
  68.            break;
  69.          case 'q':
  70.            bVerbose = FALSE ;
  71.            break;
  72.          case 'f':       //  0 1 2 3 4 5
  73.                          //  ===========
  74.                          //  - f : 8 5 0
  75.            codepage = atoi(&argv[thisarg][3]) ;
  76.            break;
  77.          default:
  78.            printf("RTFHELP:  unsupported option '%s'\n", argv[thisarg]) ;
  79.        }
  80.     }
  81.     else
  82.     { // ... otherwise it is a file name...
  83.       if (NULL == pszInput) // if we have no first file, then this is the first
  84.       {
  85.          pszInput = argv[thisarg] ;
  86.       }
  87.       else                  //   otherwise we have the second file name
  88.       {
  89.          pszOutput = argv[thisarg] ;
  90.       }
  91.     }
  92.  
  93.     thisarg++ ;
  94.   }                         // increment count of arguments processed
  95.  
  96.   return TRUE ;
  97. }
  98.  
  99.